package secondriver.springsubway.demo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

public class LifecyleBeanFactoryPostProcessor implements
		BeanFactoryPostProcessor {

	/**
	 * BeanFactoryProcessor
	 */
	@Override
	public void postProcessBeanFactory(
			ConfigurableListableBeanFactory beanFactory) throws BeansException {
		System.out
				.println("LifecyleBeanFactoryPostProcessor[postProcessBeanFactory] ConfigurableListableBeanFactory:"
						+ beanFactory);
		for (String definitionBeanName : beanFactory.getBeanDefinitionNames()) {
			System.out.println(definitionBeanName);
		}

		ApplicationContextLifecycle acl = beanFactory
				.getBean(ApplicationContextLifecycle.class);
		acl.setBeanName("by modify in LifecyleBeanFactoryPostProcessor");
	}
}
